#include <iostream>
#include <string>
#include <unistd.h>
#include "Thread.hpp"

using namespace std;

void* threadRun(void *args)
{
    std::string message = static_cast<const char *>(args);
    int cnt = 10;
    while (cnt)
    {
        cout << "我是一个线程, " << message << ", cnt: " << cnt-- << endl;
        sleep(1);
    }
    return nullptr;
}

int main()
{
    Thread t1(1, threadRun, (void *)"hellobit1");
    Thread t2(2, threadRun, (void *)"hellobit2");

    t1.run();
    t2.run();

    t1.join();
    t2.join();

    return 0;
}